import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'
import Home from '@/views/home/index.vue'
import Find from '@/views/find/index.vue'
import Talk from '@/views/talk/index.vue'
import Mine from '@/views/mine/index.vue'
import FooterCom from '@/components/FooterCom.vue'

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    
    components: {
      default:Home,
      FooterCom: FooterCom
    }
  },
  {
    path: '/find',
    name: 'find',
    components: {
      default:Find,
      FooterCom: FooterCom
    }
  }, {
    path: '/talk',
    name: 'talk',
    components: {
      default:Talk,
      FooterCom: FooterCom
    }
  }, {
    path: '/mine',
    name: 'mine',
    components: {
      default:Mine,
      FooterCom: FooterCom
    }
  },
  {
    path: '/login',
    name: 'login',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/register',
    name: 'register',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/register/index.vue')
  },
  {
    path: '/forget',
    name: 'forget',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/forget/index.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/detail/index.vue')
  },
  {
    path: '/message',
    name: 'message',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/message/index.vue')
  },{
    path: '/collect',
    name: 'collect',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/collect/index.vue')
  },
  {
    path: '/history',
    name: 'history',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/history/index.vue')
  },
  {
    path: '/changepsw',
    name: 'changepswhistory',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/changepsw/index.vue')
  },
  {
    path: '/wallet',
    name: 'wallet',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/wallet/index.vue')
  },{
    path: '/about',
    name: 'about',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/about/index.vue')
  },{
    path: '/hoster',
    name: 'hoster',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/hoster/index.vue')
  },
  {
    path: '/homedetail',
    name: 'homedetail',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/homedetail/index.vue')
  },
  {
    path: '/homemessage',
    name: 'homemessagel',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/homemessage/index.vue')
  }, {
    path: '/buying',
    name: 'buying',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/buying/index.vue')
  },
  {
    path: '/messagecenter',
    name: 'messagecenter',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/messagecenter/index.vue')
  },
  {
    path: '/talkwindow',
    name: 'talkwindow',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/talkwindow/index.vue')
  }
  ,{
    path: '/preorder',
    name: 'preorder',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/preorder/index.vue'),
     redirect: '/preorder/step1',
    children: [
      {
        path: 'step1',
        name: 'step1',
        component: () => import('../views/preorder/step1.vue'),
      },
      {
        path: 'step2',
        name: 'step2',
        component: () => import('../views/preorder/step2.vue'),
      },
      {
        path: 'step3',
        name: 'step3',
        component: () => import('../views/preorder/step3.vue'),
      },
      {
        path: 'step4',
        name: 'step4',
        component: () => import('../views/preorder/step4.vue'),
      },  {
        path: 'step5',
        name: 'step5',
        component: () => import('../views/preorder/step5.vue'),
      }
    ]
  },{
    path: '/sale',
    name: 'sale',
    // 路由元信息
    meta: {
      hidden: true,
    },
    component: () => import('../views/sale/index.vue'),
     redirect: '/sale/step12',
    children: [
      {
        path: 'step12',
        name: 'step12',
        component: () => import('../views/sale/step1.vue'),
      },
      {
        path: 'step22',
        name: 'step22',
        component: () => import('../views/sale/step2.vue'),
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes
})

export default router

